﻿@model ARMS.Models.Booking

@{
    ViewBag.Title = "Save booking";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<div>
@{
    List<SelectListItem> customers = (List<SelectListItem>)ViewData.Eval(ARMS.Controllers.BookingController.LCUSTOMERS);
    List<SelectListItem> services = (List<SelectListItem>)ViewData.Eval(ARMS.BaseClasses.Factory.LSERVICES);
    ARMS.Models.Shop shop = (ARMS.Models.Shop)ViewData.Eval(ARMS.Controllers.BookingController.CSHOP);
    string shopName = (shop != null) ? shop.name : "";
}
</div>
<h2>Make Booking</h2>

<div id="shopinfo">
    Shop: @{ @Html.Raw(String.Format("<span>{0}</span>", shopName)); }
</div>

@Html.ValidationSummary(false, "Please correct the errors and try again.")

@using(Html.BeginForm("FinaliseBooking", "Booking"))
{
<fieldset>
    <div class="detail">
    @{
        @Html.LabelFor(model => Model.id);
        @Html.Raw("<span>NEW BOOKING</span>");
        @Html.Raw("<br />");

        @Html.Label("Customer *");
        @Html.DropDownList("customerid", customers);
        @Html.ValidationMessageFor(model => Model.customerid);
        @Html.Raw("<br />");

        @Html.Label("Service *");
        @Html.DropDownList("serviceid", services);
        @Html.ValidationMessageFor(model => Model.serviceid)
        @Html.Raw("<br />");
        
        @Html.Label("note", "Note");
        @Html.TextAreaFor(model => Model.note, new { cols = 60, @rows = 8 })
        @Html.ValidationMessageFor(model => Model.note)
        @Html.Raw("<br />");
        
        @Html.Label("Enter booking date & time *");
        @Html.EditorFor(model => Model.datestamp);
        @Html.ValidationMessageFor(model => Model.datestamp)

        @Html.Raw("<br />");
        @Html.Label("Active");
        @Html.Raw("<span>SCHEDULED</span>");
        @Html.HiddenFor(model => Model.active, new {@readonly = true });
    }
    </div>
    <div class="detail buttons">
        <button class="dialog-btn" id="cancel" type="button" value="Cancel">@{@Html.ActionLink("Cancel", "Index", "Booking");}</button>
        <button class="dialog-btn" id="save" type="submit" value="Save">Save</button>
    </div>
</fieldset>
<div class="instruction clear">
    * mandatory fields.<br /><br />
</div>
<div class="instruction clear">
    <h4>Process creating the booking consist of two steps:</h4>
    <ul>
        <li>Finding the customer and service</li>
        <li>Chosing available staff for the booking</li>
    </ul>
</div>
}